<template>
	<view class="_wrapper _p20" >
		<view>测试页面</view>
		<view class="_wrapper _border _m-t-10" ref="box"></view>
	</view>
</template>

<script>
	import ToolEharts from "@/tool/ToolEcharts.js";
	import toolWeb from "@/tool/tool-web.js";
	
	let nCanvas;	
			
	export default {
		mounted() {
			this.testCanvas();
		},
		methods: {
			testEcharts() {
				console.log(this.$refs.box.$el)
				ToolEharts.initRanking(this.$refs.box.$el);
			},
			testCanvas() {
				let _this = this;
				new toolWeb.NImg(undefined, {
					src: "http://115.29.192.252:39000/public/map-icon/other-poly.png",
					onload(img) {
						console.log(img.naturalWidth, img.naturalHeight);
						nCanvas = new toolWeb.NCanvas();
						nCanvas.dom.setAttribute("width", img.naturalWidth);
						nCanvas.dom.setAttribute("height", img.naturalHeight);
						nCanvas.drawImg(img, {
							x: 0,
							y: 0,
							width: img.naturalWidth,
							height: img.naturalHeight,
						});
						nCanvas.drawText(123, { x: 20, y: 36 });
						console.log(nCanvas.toDataUrl());
						_this.$refs.box.$el.appendChild(nCanvas.dom);
					}
				});
			}
		},
	}
</script>

<style>
</style>
